package mvc;

import subject_observer.AbstractSubject;

public abstract class AbstractModel extends AbstractSubject implements IViewFactory
{

	public AbstractModel(String name, String caption)
	{
		this.name = name;
		this.caption = caption;
	}
	
	private AbstractModel()
	{
	}
	
	public AbstractView getView(int position)
	{
		AbstractView retval = null;
		
		if(position < itsIObservers.size())
		{
			retval = (AbstractView)itsIObservers.get(position);
		}
		return retval;
	}
	
	public void cleanup()
	{
		itsIObservers.clear();
	}
	
	public void setCaption(String caption)
	{
		this.caption = caption;
	}
	public String getCaption() 
	{
		return caption;
	}
	public void setName(String name)
	{
		this.name = name;
	}

	public String getName()
	{
		return name;
	}

	private String name, caption;
}
